import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
 * 软件测试实验二：构建软件测试实验环境
 */
class TriangleTest2 {

    /**
     * 一般边界值方法
     */
    @Test
    void testGeneralBoundary() {
        Assertions.assertEquals("一般三角形", Triangle.classify(5, 6, 7));
        Assertions.assertEquals("等边三角形", Triangle.classify(5, 5, 5));
        Assertions.assertEquals("等腰三角形", Triangle.classify(4, 4, 5));
        Assertions.assertEquals("非三角形", Triangle.classify(1, 1, 2));
        Assertions.assertEquals("输入错误", Triangle.classify(0, 1, 2));
        Assertions.assertEquals("等边三角形", Triangle.classify(100, 100, 100));
        Assertions.assertEquals("等腰三角形", Triangle.classify(100, 100, 99));
        Assertions.assertEquals("输入错误", Triangle.classify(99, 100, 101));
        Assertions.assertEquals("等边三角形", Triangle.classify(2, 2, 2));
        Assertions.assertEquals("等腰三角形", Triangle.classify(2, 2, 3));
        Assertions.assertEquals("一般三角形", Triangle.classify(2, 3, 4));
    }

    /**
     * 健壮性边界值方法
     */
    @Test
    void testRobustBoundary() {
        Assertions.assertEquals("一般三角形", Triangle.classify(5, 6, 7));
        Assertions.assertEquals("等边三角形", Triangle.classify(5, 5, 5));
        Assertions.assertEquals("等腰三角形", Triangle.classify(4, 4, 5));
        Assertions.assertEquals("非三角形", Triangle.classify(1, 1, 2));
        Assertions.assertEquals("输入错误", Triangle.classify(0, 1, 2));
        Assertions.assertEquals("输入错误", Triangle.classify(-1, 2, 3));
    }

    /**
     * 最坏情况一般边界值分析方法
     */
    @Test
    void testWorstCaseGeneralBoundary() {
        Assertions.assertEquals("非三角形", Triangle.classify(1, 1, 2));
        Assertions.assertEquals("输入错误", Triangle.classify(0, 1, 1));
        Assertions.assertEquals("非三角形", Triangle.classify(3, 3, 6));
        Assertions.assertEquals("非三角形", Triangle.classify(100, 1, 2));
    }

    /**
     * 最坏情况健壮性边界值分析方法
     */
    @Test
    void testWorstCaseRobustBoundary() {
        Assertions.assertEquals("非三角形", Triangle.classify(1, 1, 2));
        Assertions.assertEquals("输入错误", Triangle.classify(0, 1, 1));
        Assertions.assertEquals("非三角形", Triangle.classify(3, 3, 6));
        Assertions.assertEquals("非三角形", Triangle.classify(100, 1, 2));
        Assertions.assertEquals("输入错误", Triangle.classify(-1, 2, 3));
    }
}


